Optimal. Leaf size=191 \[ \frac {3 \left (a^2+8 a b+8 b^2\right ) x}{8 a^4}-\frac {3 \sqrt {b} \sqrt {a+b} (a+2 b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^4 f}-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 191, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.261, Rules used = {4217, 481, 541,
536, 209, 211} \begin {gather*} -\frac {3 \sqrt {b} \sqrt {a+b} (a+2 b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^4 f}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b \tan ^2(e+f x)+b\right )}-\frac {(5 a+6 b) \sin (e+f x) \cos (e+f x)}{8 a^2 f \left (a+b \tan ^2(e+f x)+b\right )}+\frac {3 x \left (a^2+8 a b+8 b^2\right )}{8 a^4}+\frac {\sin (e+f x) \cos ^3(e+f x)}{4 a f \left (a+b \tan ^2(e+f x)+b\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 209
Rule 211
Rule 481
Rule 536
Rule 541
Rule 4217
Rubi steps
\begin {align*} \int \frac {\sin ^4(e+f x)}{\left (a+b \sec ^2(e+f x)\right )^2} \, dx &=\frac {\text {Subst}\left (\int \frac {x^4}{\left (1+x^2\right )^3 \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {\text {Subst}\left (\int \frac {a+b+(-4 a-5 b) x^2}{\left (1+x^2\right )^2 \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{4 a f}\\ &=-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\text {Subst}\left (\int \frac {3 (a+b) (a+2 b)-3 b (5 a+6 b) x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{8 a^2 f}\\ &=-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\text {Subst}\left (\int \frac {6 (a+b)^2 (a+4 b)-6 b (a+b) (3 a+4 b) x^2}{\left (1+x^2\right ) \left (a+b+b x^2\right )} \, dx,x,\tan (e+f x)\right )}{16 a^3 (a+b) f}\\ &=-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {(3 b (a+b) (a+2 b)) \text {Subst}\left (\int \frac {1}{a+b+b x^2} \, dx,x,\tan (e+f x)\right )}{2 a^4 f}+\frac {\left (3 \left (a^2+8 a b+8 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{8 a^4 f}\\ &=\frac {3 \left (a^2+8 a b+8 b^2\right ) x}{8 a^4}-\frac {3 \sqrt {b} \sqrt {a+b} (a+2 b) \tan ^{-1}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{2 a^4 f}-\frac {(5 a+6 b) \cos (e+f x) \sin (e+f x)}{8 a^2 f \left (a+b+b \tan ^2(e+f x)\right )}+\frac {\cos ^3(e+f x) \sin (e+f x)}{4 a f \left (a+b+b \tan ^2(e+f x)\right )}-\frac {3 b (3 a+4 b) \tan (e+f x)}{8 a^3 f \left (a+b+b \tan ^2(e+f x)\right )}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 14.50, size = 1105, normalized size = 5.79 \begin {gather*} -\frac {(a+2 b+a \cos (2 e+2 f x))^2 \sec ^4(e+f x) \left (16 x+\frac {\left (-a^3+6 a^2 b+24 a b^2+16 b^3\right ) \text {ArcTan}\left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{b (a+b)^{3/2} f \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {\left (a^2+8 a b+8 b^2\right ) ((a+2 b) \sin (2 e)-a \sin (2 f x))}{b (a+b) f (a+2 b+a \cos (2 (e+f x))) (\cos (e)-\sin (e)) (\cos (e)+\sin (e))}\right )}{256 a^2 \left (a+b \sec ^2(e+f x)\right )^2}+\frac {3 (a+2 b+a \cos (2 e+2 f x))^2 \sec ^4(e+f x) \left (\frac {(a+2 b) \text {ArcTan}\left (\frac {\sqrt {b} \tan (e+f x)}{\sqrt {a+b}}\right )}{(a+b)^{3/2}}-\frac {a \sqrt {b} \sin (2 (e+f x))}{(a+b) (a+2 b+a \cos (2 (e+f x)))}\right )}{1024 b^{3/2} f \left (a+b \sec ^2(e+f x)\right )^2}+\frac {(a+2 b+a \cos (2 e+2 f x))^2 \sec ^4(e+f x) \left (-\frac {\left (a^5-30 a^4 b-480 a^3 b^2-1600 a^2 b^3-1920 a b^4-768 b^5\right ) \text {ArcTan}\left (\frac {\sec (f x) (\cos (2 e)-i \sin (2 e)) (-((a+2 b) \sin (f x))+a \sin (2 e+f x))}{2 \sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}\right ) (\cos (2 e)-i \sin (2 e))}{\sqrt {a+b} \sqrt {b (\cos (e)-i \sin (e))^4}}+\frac {\sec (2 e) \left (32 b \left (5 a^4+39 a^3 b+106 a^2 b^2+120 a b^3+48 b^4\right ) f x \cos (2 e)+16 a b \left (5 a^3+29 a^2 b+48 a b^2+24 b^3\right ) f x \cos (2 f x)+80 a^4 b f x \cos (4 e+2 f x)+464 a^3 b^2 f x \cos (4 e+2 f x)+768 a^2 b^3 f x \cos (4 e+2 f x)+384 a b^4 f x \cos (4 e+2 f x)+a^5 \sin (2 e)+34 a^4 b \sin (2 e)+224 a^3 b^2 \sin (2 e)+576 a^2 b^3 \sin (2 e)+640 a b^4 \sin (2 e)+256 b^5 \sin (2 e)-a^5 \sin (2 f x)-62 a^4 b \sin (2 f x)-318 a^3 b^2 \sin (2 f x)-512 a^2 b^3 \sin (2 f x)-256 a b^4 \sin (2 f x)-12 a^4 b \sin (2 (e+2 f x))-36 a^3 b^2 \sin (2 (e+2 f x))-24 a^2 b^3 \sin (2 (e+2 f x))-30 a^4 b \sin (4 e+2 f x)-158 a^3 b^2 \sin (4 e+2 f x)-256 a^2 b^3 \sin (4 e+2 f x)-128 a b^4 \sin (4 e+2 f x)-12 a^4 b \sin (6 e+4 f x)-36 a^3 b^2 \sin (6 e+4 f x)-24 a^2 b^3 \sin (6 e+4 f x)+2 a^4 b \sin (4 e+6 f x)+2 a^3 b^2 \sin (4 e+6 f x)+2 a^4 b \sin (8 e+6 f x)+2 a^3 b^2 \sin (8 e+6 f x)\right )}{a+2 b+a \cos (2 (e+f x))}\right )}{1024 a^4 b (a+b) f \left (a+b \sec ^2(e+f x)\right )^2} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.22, size = 147, normalized size = 0.77
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-a b -\frac {5}{8} a^{2}\right ) \left (\tan ^{3}\left (f x +e \right )\right )+\left (-\frac {3}{8} a^{2}-a b \right ) \tan \left (f x +e \right )}{\left (\tan ^{2}\left (f x +e \right )+1\right )^{2}}+\frac {3 \left (a^{2}+8 a b +8 b^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{8}}{a^{4}}-\frac {\left (a +b \right ) b \left (\frac {a \tan \left (f x +e \right )}{2 a +2 b +2 b \left (\tan ^{2}\left (f x +e \right )\right )}+\frac {3 \left (a +2 b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{2 \sqrt {\left (a +b \right ) b}}\right )}{a^{4}}}{f}\) | \(147\) |
default | \(\frac {\frac {\frac {\left (-a b -\frac {5}{8} a^{2}\right ) \left (\tan ^{3}\left (f x +e \right )\right )+\left (-\frac {3}{8} a^{2}-a b \right ) \tan \left (f x +e \right )}{\left (\tan ^{2}\left (f x +e \right )+1\right )^{2}}+\frac {3 \left (a^{2}+8 a b +8 b^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{8}}{a^{4}}-\frac {\left (a +b \right ) b \left (\frac {a \tan \left (f x +e \right )}{2 a +2 b +2 b \left (\tan ^{2}\left (f x +e \right )\right )}+\frac {3 \left (a +2 b \right ) \arctan \left (\frac {b \tan \left (f x +e \right )}{\sqrt {\left (a +b \right ) b}}\right )}{2 \sqrt {\left (a +b \right ) b}}\right )}{a^{4}}}{f}\) | \(147\) |
risch | \(\frac {3 x}{8 a^{2}}+\frac {3 x b}{a^{3}}+\frac {3 x \,b^{2}}{a^{4}}-\frac {i {\mathrm e}^{4 i \left (f x +e \right )}}{64 a^{2} f}+\frac {i {\mathrm e}^{2 i \left (f x +e \right )}}{8 a^{2} f}+\frac {i {\mathrm e}^{2 i \left (f x +e \right )} b}{4 a^{3} f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )}}{8 a^{2} f}-\frac {i {\mathrm e}^{-2 i \left (f x +e \right )} b}{4 a^{3} f}+\frac {i {\mathrm e}^{-4 i \left (f x +e \right )}}{64 a^{2} f}-\frac {i b \left (a^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 a b \,{\mathrm e}^{2 i \left (f x +e \right )}+2 b^{2} {\mathrm e}^{2 i \left (f x +e \right )}+a^{2}+a b \right )}{a^{4} f \left (a \,{\mathrm e}^{4 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+4 b \,{\mathrm e}^{2 i \left (f x +e \right )}+a \right )}+\frac {3 \sqrt {-a b -b^{2}}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b -b^{2}}+a +2 b}{a}\right )}{4 f \,a^{3}}+\frac {3 \sqrt {-a b -b^{2}}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+\frac {2 i \sqrt {-a b -b^{2}}+a +2 b}{a}\right ) b}{2 f \,a^{4}}-\frac {3 \sqrt {-a b -b^{2}}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b -b^{2}}-a -2 b}{a}\right )}{4 f \,a^{3}}-\frac {3 \sqrt {-a b -b^{2}}\, \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {2 i \sqrt {-a b -b^{2}}-a -2 b}{a}\right ) b}{2 f \,a^{4}}\) | \(458\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.49, size = 213, normalized size = 1.12 \begin {gather*} -\frac {\frac {3 \, {\left (3 \, a b + 4 \, b^{2}\right )} \tan \left (f x + e\right )^{5} + {\left (5 \, a^{2} + 24 \, a b + 24 \, b^{2}\right )} \tan \left (f x + e\right )^{3} + 3 \, {\left (a^{2} + 5 \, a b + 4 \, b^{2}\right )} \tan \left (f x + e\right )}{a^{3} b \tan \left (f x + e\right )^{6} + {\left (a^{4} + 3 \, a^{3} b\right )} \tan \left (f x + e\right )^{4} + a^{4} + a^{3} b + {\left (2 \, a^{4} + 3 \, a^{3} b\right )} \tan \left (f x + e\right )^{2}} - \frac {3 \, {\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} {\left (f x + e\right )}}{a^{4}} + \frac {12 \, {\left (a^{2} b + 3 \, a b^{2} + 2 \, b^{3}\right )} \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a^{4}}}{8 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.47, size = 546, normalized size = 2.86 \begin {gather*} \left [\frac {3 \, {\left (a^{3} + 8 \, a^{2} b + 8 \, a b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 3 \, {\left (a^{2} b + 8 \, a b^{2} + 8 \, b^{3}\right )} f x + 3 \, {\left ({\left (a^{2} + 2 \, a b\right )} \cos \left (f x + e\right )^{2} + a b + 2 \, b^{2}\right )} \sqrt {-a b - b^{2}} \log \left (\frac {{\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} \cos \left (f x + e\right )^{4} - 2 \, {\left (3 \, a b + 4 \, b^{2}\right )} \cos \left (f x + e\right )^{2} + 4 \, {\left ({\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{3} - b \cos \left (f x + e\right )\right )} \sqrt {-a b - b^{2}} \sin \left (f x + e\right ) + b^{2}}{a^{2} \cos \left (f x + e\right )^{4} + 2 \, a b \cos \left (f x + e\right )^{2} + b^{2}}\right ) + {\left (2 \, a^{3} \cos \left (f x + e\right )^{5} - {\left (5 \, a^{3} + 6 \, a^{2} b\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (3 \, a^{2} b + 4 \, a b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{8 \, {\left (a^{5} f \cos \left (f x + e\right )^{2} + a^{4} b f\right )}}, \frac {3 \, {\left (a^{3} + 8 \, a^{2} b + 8 \, a b^{2}\right )} f x \cos \left (f x + e\right )^{2} + 3 \, {\left (a^{2} b + 8 \, a b^{2} + 8 \, b^{3}\right )} f x + 6 \, {\left ({\left (a^{2} + 2 \, a b\right )} \cos \left (f x + e\right )^{2} + a b + 2 \, b^{2}\right )} \sqrt {a b + b^{2}} \arctan \left (\frac {{\left (a + 2 \, b\right )} \cos \left (f x + e\right )^{2} - b}{2 \, \sqrt {a b + b^{2}} \cos \left (f x + e\right ) \sin \left (f x + e\right )}\right ) + {\left (2 \, a^{3} \cos \left (f x + e\right )^{5} - {\left (5 \, a^{3} + 6 \, a^{2} b\right )} \cos \left (f x + e\right )^{3} - 3 \, {\left (3 \, a^{2} b + 4 \, a b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{8 \, {\left (a^{5} f \cos \left (f x + e\right )^{2} + a^{4} b f\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sin ^{4}{\left (e + f x \right )}}{\left (a + b \sec ^{2}{\left (e + f x \right )}\right )^{2}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.53, size = 193, normalized size = 1.01 \begin {gather*} \frac {\frac {3 \, {\left (a^{2} + 8 \, a b + 8 \, b^{2}\right )} {\left (f x + e\right )}}{a^{4}} - \frac {12 \, {\left (a^{2} b + 3 \, a b^{2} + 2 \, b^{3}\right )} {\left (\pi \left \lfloor \frac {f x + e}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (b\right ) + \arctan \left (\frac {b \tan \left (f x + e\right )}{\sqrt {a b + b^{2}}}\right )\right )}}{\sqrt {a b + b^{2}} a^{4}} - \frac {4 \, {\left (a b \tan \left (f x + e\right ) + b^{2} \tan \left (f x + e\right )\right )}}{{\left (b \tan \left (f x + e\right )^{2} + a + b\right )} a^{3}} - \frac {5 \, a \tan \left (f x + e\right )^{3} + 8 \, b \tan \left (f x + e\right )^{3} + 3 \, a \tan \left (f x + e\right ) + 8 \, b \tan \left (f x + e\right )}{{\left (\tan \left (f x + e\right )^{2} + 1\right )}^{2} a^{3}}}{8 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.77, size = 435, normalized size = 2.28 \begin {gather*} \frac {3\,\mathrm {atanh}\left (\frac {27\,b^3\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-b^2-a\,b}}{64\,\left (\frac {27\,a\,b^3}{64}+\frac {81\,b^4}{64}+\frac {27\,b^5}{32\,a}\right )}+\frac {27\,b^4\,\mathrm {tan}\left (e+f\,x\right )\,\sqrt {-b^2-a\,b}}{32\,\left (\frac {27\,a^2\,b^3}{64}+\frac {81\,a\,b^4}{64}+\frac {27\,b^5}{32}\right )}\right )\,\left (a+2\,b\right )\,\sqrt {-b\,\left (a+b\right )}}{2\,a^4\,f}-\frac {\frac {3\,{\mathrm {tan}\left (e+f\,x\right )}^5\,\left (4\,b^2+3\,a\,b\right )}{8\,a^3}+\frac {{\mathrm {tan}\left (e+f\,x\right )}^3\,\left (5\,a^2+24\,a\,b+24\,b^2\right )}{8\,a^3}+\frac {3\,\mathrm {tan}\left (e+f\,x\right )\,\left (a^2+5\,a\,b+4\,b^2\right )}{8\,a^3}}{f\,\left (b\,{\mathrm {tan}\left (e+f\,x\right )}^6+\left (a+3\,b\right )\,{\mathrm {tan}\left (e+f\,x\right )}^4+\left (2\,a+3\,b\right )\,{\mathrm {tan}\left (e+f\,x\right )}^2+a+b\right )}-\frac {\mathrm {atan}\left (\frac {27\,b^2\,\mathrm {tan}\left (e+f\,x\right )}{256\,\left (\frac {27\,b^2}{256}+\frac {243\,b^3}{256\,a}+\frac {27\,b^4}{16\,a^2}+\frac {27\,b^5}{32\,a^3}\right )}+\frac {243\,b^3\,\mathrm {tan}\left (e+f\,x\right )}{256\,\left (\frac {27\,a\,b^2}{256}+\frac {243\,b^3}{256}+\frac {27\,b^4}{16\,a}+\frac {27\,b^5}{32\,a^2}\right )}+\frac {27\,b^4\,\mathrm {tan}\left (e+f\,x\right )}{16\,\left (\frac {243\,a\,b^3}{256}+\frac {27\,b^4}{16}+\frac {27\,a^2\,b^2}{256}+\frac {27\,b^5}{32\,a}\right )}+\frac {27\,b^5\,\mathrm {tan}\left (e+f\,x\right )}{32\,\left (\frac {27\,a^3\,b^2}{256}+\frac {243\,a^2\,b^3}{256}+\frac {27\,a\,b^4}{16}+\frac {27\,b^5}{32}\right )}\right )\,\left (a^2\,1{}\mathrm {i}+a\,b\,8{}\mathrm {i}+b^2\,8{}\mathrm {i}\right )\,3{}\mathrm {i}}{8\,a^4\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________